package com.laf.common.enums;

import lombok.Getter;

@Getter
public enum SMSTypeEnum {
    REGISTER(1, "注册", "phone:register:captcha:"),
    FORGET_PASSWORD(2, "忘记密码", "phone:pwd:captcha:");

    private final Integer code;
    private final String desc;
    private final String key;

    SMSTypeEnum(Integer code, String desc, String key) {
        this.code = code;
        this.desc = desc;
        this.key = key;
    }

    public static String getDesc(Integer code) {
        for (SMSTypeEnum value : SMSTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getDesc();
            }
        }
        return null;
    }

    public static SMSTypeEnum getEnum(Integer code) {
        for (SMSTypeEnum value : SMSTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}

